package com.xinyue.user.utils;

import java.io.File;
import java.io.IOException;
import java.util.Date;

import org.springframework.web.multipart.MultipartFile;

public class FileRenameUtil {

	public static String save(MultipartFile file) throws Exception {
		String name = file.getOriginalFilename();
		String subfix = name.substring(name.indexOf("."));
		String newname = new Date().getTime()+subfix;
		file.transferTo(new File("D:/upload/img/"+newname));
		return newname;
	}
	
}
